#ifndef LPF_H
#define LPF_H

#ifdef __cplusplus
extern "C"
{
#endif
/*---------------------------- C Scope ---------------------------*/

#include "stdint.h"

#ifdef __cplusplus
}
#endif
/*---------------------------- C++ Scope ---------------------------*/
class LowPassFilter{

    private:
    float alpha;
    float now_value;
    float last_value;
    public:
    LowPassFilter(float _alpha = 0.99f):alpha(_alpha){};
    float update(float _value)
    {
        last_value = now_value;
        now_value = _value;
        now_value = now_value * alpha + (1-alpha)*last_value;
        return now_value;
    }
};


#endif
